/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package testing;

import java.io.IOException;
import net.aksingh.owmjapis.CurrentWeather;
import net.aksingh.owmjapis.OpenWeatherMap;

/**
 *
 * @author takamflore
 */
public class WeatherBaenTest {
    
      // declaring object of "OpenWeatherMap" class
    public OpenWeatherMap owm = new OpenWeatherMap("");
    public String city;
        CurrentWeather cwd;

        // checking data retrieval was successful or not
       

    public WeatherBaenTest()throws IOException {
        this.cwd = owm.currentWeatherByCityName(city);
    
            // checking if city name is available
            if (cwd.hasCityName()) {
                //printing city name from the retrieved data
                System.out.println("City: " + cwd.getCityName());
            }

            // checking if max. temp. and min. temp. is available
            if (cwd.getMainInstance().hasMaxTemperature() && cwd.getMainInstance().hasMinTemperature()) {
                // printing the max./min. temperature
                System.out.println("Temperature: " + cwd.getMainInstance().getMaxTemperature()
                            + "/" + cwd.getMainInstance().getMinTemperature() + "\'F");
            }
        }
    }

